﻿namespace WebMarkupMin.Example.WebForms
{
	using System.Web.Optimization;

	using BundleTransformer.Core.Bundles;
	using BundleTransformer.Core.Orderers;

	public class BundleConfig
	{
		public static void RegisterBundles(BundleCollection bundles)
		{
			bundles.UseCdn = true;

			var nullOrderer = new NullOrderer();

			var commonStylesBundle = new CustomStyleBundle("~/Bundles/CommonStyles");
			commonStylesBundle.Include("~/Content/fonts/fonts.css",
				"~/Content/all.less");
			commonStylesBundle.Orderer = nullOrderer;

			bundles.Add(commonStylesBundle);

			var modernizrBundle = new CustomScriptBundle("~/Bundles/Modernizr");
			modernizrBundle.Include("~/Scripts/modernizr-2.*");
			modernizrBundle.Orderer = nullOrderer;

			bundles.Add(modernizrBundle);

			var jQueryBundle = new CustomScriptBundle("~/Bundles/Jquery",
				"http://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.11.1.min.js");
			jQueryBundle.Include("~/Scripts/jquery-{version}.js");
			jQueryBundle.Orderer = nullOrderer;
			jQueryBundle.CdnFallbackExpression = "window.jquery";

			bundles.Add(jQueryBundle);

			var commonScriptsBundle = new CustomScriptBundle("~/Bundles/CommonScripts");
			commonScriptsBundle.Include("~/Scripts/bootstrap/bootstrap-dropdown.js",
				"~/Scripts/webmarkupmin/common.js");
			commonScriptsBundle.Orderer = nullOrderer;

			bundles.Add(commonScriptsBundle);

			var webFormsBundle = new CustomScriptBundle("~/Bundles/WebFormsJs");
			webFormsBundle.Include(
				"~/Scripts/WebForms/WebForms.js",
				"~/Scripts/WebForms/WebUIValidation.js",
				"~/Scripts/WebForms/MenuStandards.js",
				"~/Scripts/WebForms/Focus.js",
				"~/Scripts/WebForms/GridView.js",
				"~/Scripts/WebForms/DetailsView.js",
				"~/Scripts/WebForms/TreeView.js",
				"~/Scripts/WebForms/WebParts.js");
			webFormsBundle.Orderer = nullOrderer;

			bundles.Add(webFormsBundle);

			var msAjaxBundle = new CustomScriptBundle("~/Bundles/MsAjaxJs");
			msAjaxBundle.Include(
				"~/Scripts/WebForms/MsAjax/MicrosoftAjax.js",
				"~/Scripts/WebForms/MsAjax/MicrosoftAjaxApplicationServices.js",
				"~/Scripts/WebForms/MsAjax/MicrosoftAjaxTimer.js",
				"~/Scripts/WebForms/MsAjax/MicrosoftAjaxWebForms.js");
			msAjaxBundle.Orderer = nullOrderer;

			bundles.Add(msAjaxBundle);
		}
	}
}